<html>
<head>
<title>Free Stuff</title>
<link rel="stylesheet" type="text/css" href="common.css" />
<script>
function validateForm() {
var invalid = " "; // Invalid character is a space
var minLength = 6; // Minimum length
var pw1 = document.signup.password1.value;
var pw2 = document.signup.password2.value;
var firstName = document.signup.firstName.value;
var lastName = document.signup.lastName.value;
var email = document.signup.email.value;
// check for a value in both fields.
if (pw1 == '' || pw2 == '') {
alert('Please enter your password twice.');
return false;
}
// check for minimum length
if (document.signup.password1.value.length < minLength) {
alert('Your password must be at least ' + minLength + ' characters long. Try again.');
return false;
}

if(firstName.length<1 ||lastName.length<1 ||email.length<1){
	alert('Please enter the required fields');
	return false;
}
// check for spaces
if (document.signup.password1.value.indexOf(invalid) > -1) {
alert("Sorry, spaces are not allowed.");
return false;
}
else {
if (pw1 != pw2) {
alert ("You did not enter the same new password twice. Please re-enter your password.");
return false;
}
}
}
//  End -->
</script>
</head>

<body >

<div class="coly coly-wide" style="margin-right: 15px;"> 
  <form action = "UserSignup.php"name = "signup" method="post" onSubmit="validateForm()"> 
  <table  align="center" cellpadding="2" cellspacing="0" bordercolor="#CCCCCC" >
	<tr>
    <div class="append-bottom"> 
      <td><label for="external_person_first_name">First Name:</label></td>      
	  <td><input class="ls-text" id="external_person_first_name" name="firstName" size="30" tabindex="1" type="text" /> </td>
    </div>
	</tr>
	<tr>
    <div class="append-bottom"> 
      <td><label for="external_person_last_name">Last Name:</label></td>
	  <td><input class="ls-text" id="external_person_last_name" name="lastName" size="30" tabindex="2" type="text" /> </td>
    </div> 
	</tr>
	<tr>
    <div class="append-bottom"> 
        <td><label for="person_email">Email Address:</label></td>
        <td><input class="ls-text" id="person_email" name="email" size="30" tabindex="3" type="email"/> </td>
    </div> 
	<tr>
    <div class="append-bottom"> 
      <td><label for="external_person_password">Password:</label></td>
	  <td><input autocomplete="OFF" class="ls-text" id="external_person_password" name="password1" size="30" tabindex="4" type=
	  "password" /> </td>
    </div> 
	</tr>
	<tr>
    <div class="append-bottom"> 
      <td><label for="external_person_password_confirmation">Confirm Password:</label> </td>
	  <td><input autocomplete="OFF" class="ls-text" id="external_person_password_confirmation" name="password2" size=
	  "30" tabindex="5" type="password" /> </td>
    </div> 
	</tr>
	</table>
 
    <div class="append-bottom"> 
      By registering you agree to the <a href="https://livingsocial.com/terms" target="_blank">Terms and Conditions</a> and <a href=
	  "https://livingsocial.com/privacy-policy" target="_blank">Privacy Policy</a>.
    </div> 
 
    <div class="append-bottom"> 
      <button type="submit"><span>Sign Up</span></button> 
    </div> 
	</div>
  </form> 
</div> 
</body>